package com.jf.thread;

public class Test02 {
    public static void main(String[] args) {
        Student s1 = new Student("s1");
        s1.start();
        Thread t1 = new Thread(new Teacher(),"t1");
        t1.start();

        Thread t2 = new Thread(()->{
            for (int i = 1; i < 101; i++) {
                System.out.println(Thread.currentThread().getName());
                System.out.println("java8方式创建线程："+i);
            }
        },"t2");
        t2.start();

        Thread t3 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 1; i < 101; i++) {
                    System.out.println(Thread.currentThread().getName());
                    System.out.println("匿名内部类方式创建线程："+i);
                }
            }
        },"t3");
        t3.start();
    }
}
